# -*- encoding=utf8 -*-
import json
import os
from selenium import webdriver

from config import BASE_DIR


def read_json(filepath,key):
    arr = []
    with open(filepath,'r',encoding='utf-8') as f:
        json_data = json.load(f).get(key)
        for data in json_data:
            arr.append(tuple(data.values()))
        return arr


class getDriver:
    __web_driver = None

    @classmethod
    def get_driver(cls):
        if cls.__web_driver is None:
           options =  webdriver.ChromeOptions()
           options.add_experimental_option("detach",True)
           cls.__web_driver = webdriver.Chrome(options=options)
        return cls.__web_driver
